home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / mkButton.tcl < prev    next >
Text File  |  1994-09-20  |  1KB  |  34 lines

  1. # mkButton w
  2. #
  3. # Create a top-level window that displays a bunch of buttons.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkButton {{w .b1}} {
  9.     catch {destroy $w}
  10.     toplevel $w
  11.     dpos $w
  12.     wm title $w "Button Demonstration"
  13.     wm iconname $w "Buttons"
  14.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
  15.         -text "Four buttons are displayed below.  If you click on a button, it will change the background of the button area to the color indicated in the button.  Click the \"OK\" button when you've seen enough."
  16.     frame $w.frame -borderwidth 10
  17.     button $w.ok -text OK -command "destroy $w"
  18.  
  19.     pack $w.msg -side top -fill both
  20.     pack $w.frame -side top -expand yes -fill both
  21.     pack $w.ok -side bottom -fill both
  22.  
  23.     button $w.frame.b1 -text "Peach Puff" \
  24.         -command "$w.frame config -bg PeachPuff1"
  25.     button $w.frame.b2 -text "Light Blue" \
  26.         -command "$w.frame config -bg LightBlue1"
  27.     button $w.frame.b3 -text "Sea Green" \
  28.         -command "$w.frame config -bg SeaGreen2"
  29.     button $w.frame.b4 -text "Yellow" \
  30.         -command "$w.frame config -bg Yellow1"
  31.     pack $w.frame.b1 $w.frame.b2 $w.frame.b3 $w.frame.b4 -side top \
  32.         -expand yes -pady 2
  33. }
  34.